package com.ydd.utils;

import com.github.pagehelper.Page;
import com.ydd.result.PageResult;

import java.util.List;

/**
 * PageResult返回数据工具
 */
public class PageResultUtil {
    public static PageResult getPageResult(Page page){
        Long count = page.getTotal();
        Integer totalPages = page.getPages();
        Integer pageSize = page.getPageSize();
        Integer currentPage = page.getPageNum();
        List data = page.getResult();
        return new PageResult(count,totalPages,pageSize,currentPage,data);
    }
}
